<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>任务记录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="../default/css/mui.min.css">
    <link rel="stylesheet" type="text/css" href="../default/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="../default/css/animat.min.css"/>
    <style type="text/css">
        .mui-content>.mui-table-view:first-child {
            margin-top: -1px;
        }
        html,
        body {
            background-color: #efeff4;
        }
        .mui-table-view-chevron .mui-table-view-cell{
            padding: 0;
        }
        .mui-table-view{
            background-color: #efeff4;
        }
        .mui-card-content-inner p{
            padding: 5px 0;
        }
    </style>
</head>

<body>

<header class="mui-bar mui-bar-nav">
    <a class="mui-icon mui-icon-left-nav mui-pull-left backahter"></a>
    <h1 class="mui-title">任务记录</h1>
</header>
<!--下拉刷新容器-->
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
    <div class="mui-scroll">
        <!--数据列表-->
        <ul class="mui-table-view mui-table-view-chevron" id="task-record-list">
            <div class="mui-loading">
                <div class="mui-spinner">
                </div>
            </div>
        </ul>
    </div>
</div>
<script src="../default/js/jquery-2.14.js" type="text/javascript" charset="utf-8"></script>
<script src="../default/js/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../default/js/cookie.js"></script>
<script src="../default/js/code.js" type="text/javascript" charset="utf-8"></script>
<script src="../default/js/index.js" type="text/javascript" charset="utf-8"></script>
<script src="../default/js/public.js"></script>
<script>



    $(function () {
        findByUserId();
    });

    mui.init();
    mui('.mui-scroll-wrapper').scroll({
        deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
    });

    mui('header').on('tap', '.backahter', function (e) {
        localStorage.removeItem('orderId');
        //打开详情页面
        mui.openWindow({
            url: 'task.html'
        });
    });


    function findByUserId() {
        mui.showLoading("正在加载..", "div");
        $.ajax({
            url:website+'/ForwardController/findByUserId',
            type:'post',
            data:{
                userId:userId
            },
            success:function (data) {
                var html='';
                console.log(data);
                data.data.forEach(function (value) {
                    if(value.taskType!=null){
                        html+='<li class="mui-table-view-cell" data-order-id="'+value.id+'">\n' +
                            '                                <div class="mui-card">\n' +
                            '                                    <div class="mui-card-header">\n' +
                            '                                        <p>任务名:'+value.taskType.taskName+'</p>\n' +
                            '                                        <p class="red">'+value.status+'</p>\n' +
                            '                                    </div>\n' +
                            '                                    <div class="mui-card-content">\n' +
                            '                                        <div class="mui-card-content-inner">\n'+
                            '                                            <p>提交时间:'+value.forwardingTime+'</p>\n';
                            if(value.reason!=null){
                                html+='<p>审核信息:'+value.reason+'</p>';
                            }
                            if(value.paymentTime!=null){
                                html+='<p>审核时间:'+value.paymentTime+'</p>';
                            }
                        html+=
                            '                                        </div>\n' +
                            '                                    </div>\n' +
                            '                                    <div class="mui-card-footer">\n' +
                            '                                        <p>任务金额:￥'+value.amountOfPayment+'</p>\n' +
                            '                                    </div>\n' +
                            '                                </div>\n' +
                            '                            </li>'
                    }
                });

                mui.hideLoading();
                $("#task-record-list").html(html);

            },error:function () {
                mui.showLoading("发生错误,返回首页..","div");
                setTimeout(function () {
                    window.location.href = 'http://newst.whilte.com/index.html';
                },1000)
            }
        })

    }


</script>
</body>

</html>